package com.qf.spring2202.aop.advice;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

public class MyAroundAdvice implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {

        System.out.println("!!!!!!!!!!!!!!!! MyAroundAdvice 前置");
        //1. 前置逻辑
        final long start = System.currentTimeMillis();

        //2. 调用原始对象的方法
        final Object result = invocation.proceed();

        //3. 后置逻辑
        final long end = System.currentTimeMillis();

        System.out.println("times used = "+(end-start) );
        System.out.println("!!!!!!!!!!!!!!!! MyAroundAdvice 后置");
        return result;
    }
}
